import 'package:dio/dio.dart';
import 'package:flutter/material.dart';

typedef ErrorCallback = void Function(Exception);

class DownloadTask {
  String name = "";
  String url = "";
  String savePath = "";
  CancelToken? cancelToken;
  final callbacks = <TaskCallback>[];
  String status = "pause"; // loading,pause,done,success,failed

  @override
  String toString() {
    return { url: url, savePath: savePath, status: status }.toString();
  }
}

class TaskCallback {
  final ProgressCallback? processCallback;
  final VoidCallback? successCallback;

  final ErrorCallback? errorCallback;

  TaskCallback(this.processCallback, this.successCallback, this.errorCallback);
}
